﻿@{
    ViewBag.Title = "InspectionBillDetail";
    Layout = "~/Views/Shared/_Form.cshtml";
}

<script>
    var keyValue = request('keyValue');
    var BillCode = request('BillCode');
    var Type = request('Type');
    $(function () {
        initControl();
    })
    function initControl() {
        //复验状态选择
        $("#IsPass .dropdown-menu li").click(function () {
            var text = $(this).find('a').html();
            var value = $(this).find('a').attr('data-value');
            $("#IsPass .dropdown-text").html(text).attr('data-value', value);
        });
        //获取表单
        if (!!keyValue) {
            $.SetForm({
                url: "../../PropertyManage/CS_Decorate/GetInspectionBillDetailEntity",
                param: { keyValue: keyValue },
                success: function (data) {
                    $("#form1").SetWebControls(data);
                    if (data.IsPass != null && data.IsPass == 1) {
                        $("#IsPass .dropdown-text").attr('data-value', data.IsPass);
                        $("#IsPass .dropdown-text").text("通过");
                    }
                }
            });
        }
    }

    //保存表单
    function AcceptClick() {
        if (!$('#form1').Validform()) {
            return false;
        }
        var postData = $("#form1").GetWebControls();
        postData["IsPass"] = $("#IsPass .dropdown-text").attr('data-value');
        
        $.SaveForm({
            url: "../../PropertyManage/CS_Decorate/InspectionBillDetaiForm?keyValue=" + keyValue + "&BillCode=" + BillCode + "&Type=" + Type,
            param: postData,
            loading: "正在保存数据...",
            success: function () {
                top.frames["Form"].$("#gridtable6").trigger("reloadGrid");
            }
        })
    }

</script>

<div style="margin-left: 10px; margin-top: 20px; margin-right: 30px;">
    <table class="form">
        <tr>
            <th class="formTitle">是否通过</th>
            <td class="formValue">
                <div id="IsPass" class="btn-group">
                    <a class="btn btn-default dropdown-text" data-toggle="dropdown" data-value="0" style="width:237px;">不通过</a>
                    <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
                    <ul class="dropdown-menu" style="width:237px;">
                        <li><a data-value="0">不通过</a></li>
                        <li><a data-value="1">通过</a></li>
                    </ul>
                </div>
            </td>
        </tr>
        <tr>
            <th class="formTitle" valign="top" style="padding-top: 4px;">
                原因说明
            </th>
            <td class="formValue">
                <textarea id="Memo" class="form-control" style="height: 70px;"></textarea>
            </td>
        </tr>
    </table>
</div>


